#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020-12-16 9:53 上午
# @Author  : yangdy
# @File    : 2020-12-16.1686.石子游戏VI
# @Software: PyCharmCE
from tools.my_methods import *


class Solution:
    def stoneGameVI(self, aliceValues: List[int], bobValues: List[int]) -> int:
        data = [[aliceValues[i] + bobValues[i], i] for i in range(len(aliceValues))]
        data.sort(key=lambda x: x[0], reverse=True)
        a = sum(aliceValues[data[i][1]] for i in range(0, len(data), 2))
        b = sum(bobValues[data[i][1]] for i in range(1, len(data), 2))
        # a, b = 0, 0
        # for i in range(len(data)):
        #     if i % 2 == 0:
        #         a += aliceValues[data[i][1]]
        #     else:
        #         b += bobValues[data[i][1]]
        return 0 if a == b else (1 if a > b else -1)


questions = [
    ([1, 3], [2, 1],),
    ([1, 2], [3, 1],),
    ([2, 4, 3], [1, 6, 7],),
]

work(questions, lambda q: Solution().stoneGameVI(q[0], q[1]))

